package tut.mysql.load.loadThread;

import tut.mysql.db.Db;

public class ClickThread extends InsertCtl {

	public static String CLICK_TABLE = "click_log_test";
	String file_path = "/var/tmp/click_log_test.tsv";

	public ClickThread(int queries, Db db) {
		super(db);

		StringBuilder sql = new StringBuilder();
		sql.append("LOAD DATA LOCAL INFILE '").append(file_path).append("'");
		sql.append(" REPLACE");
		sql.append(" INTO TABLE ").append(CLICK_TABLE);
		sql.append(" FIELDS");
		sql.append("  TERMINATED BY '\\t'");
		sql.append("  ESCAPED BY '\\\\'");
		sql.append(" LINES");
		sql.append("  STARTING BY ''");
		sql.append("  TERMINATED BY '\\n'");
		sql.append(" IGNORE 1 LINES");
		sql.append(" (");
		sql.append("buyer_id,site_id,item_id,location_id,campaign_id,article_id,link_id,image_id,keyword_id,click_date,uid,xuid,"
				+ "suid,terminal_type,sad,carrier_id,model_id,cv_app_id,app_store_id,app_sdk_id,xuniq )");

		this.sql = sql.toString();

		this.maxQueries = queries;
	}

}
